//
// Created by 吴锐 on 2022/3/2.
//

#include "iostream"
#include "list"
#include "algorithm"

using namespace std;

void printList(list<int> &l) {
    for (list<int>::iterator it = l.begin(); it != l.end(); it++) {
        cout << *it << " ";
    }
    cout << endl;
}

bool myCompare(int a, int b){
    return a > b;
}

void test01() {
    list<int> l;
    l.push_back(10);
    l.push_back(40);
    l.push_back(20);
    l.push_back(50);

    l.push_back(30);
    printList(l);

    l.reverse();
    printList(l);

//    sort(l.begin(), l.end());
    l.sort(myCompare);
    printList(l);
}

int main() {
    test01();
    return 0;
}